<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript">
    var contextPath = "${ctx}";
</script>
<div class="pages">
    <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=1" class="p_pre">首页</a>
    <c:if test="${requestScope.page.pageNo==1}">
        <a href="#" class="p_pre">上一页</a>
    </c:if>
    <c:if test="${requestScope.page.pageNo>1}">
        <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=${requestScope.page.pageNo-1}"
           class="p_pre">上一页</a>
    </c:if>

    <c:forEach
            begin="${requestScope.page.pageNo-2<1?1:requestScope.page.pageNo-2}"
            end="${requestScope.page.pageNo+2<requestScope.page.pageSum?requestScope.page.pageNo+2:requestScope.page.pageSum}"
            step="1" var="c">
        <c:if test="${c==requestScope.page.pageNo}">
            <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=${c}"
               class="cur">${c}</a>
        </c:if>
        <c:if test="${c!=requestScope.page.pageNo}">
            <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=${c}">${c}</a>
        </c:if>
    </c:forEach>
    <c:if test="${requestScope.page.pageNo<requestScope.page.pageSum-2}">
        ...
        <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=${requestScope.page.pageSum}">${requestScope.page.pageSum}</a>
    </c:if>


    <c:if test="${requestScope.page.pageNo<requestScope.page.pageSum}">
        <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=${requestScope.page.pageNo+1}"
           class="p_pre">下一页</a>
    </c:if>
    <c:if test="${requestScope.page.pageNo==requestScope.page.pageSum}">
        <a href=#" class="p_pre">下一页</a>
    </c:if>
    <a href="/goods/queryGoodsList?keyWord=${requestScope.keyWord}&id=${requestScope.id}&pageNo=${requestScope.page.pageSum}"
       class="p_pre">尾页</a>
    <c:if test="${requestScope.page.pageCount==0}">
        暂无记录
    </c:if>
</div>
